﻿using System;
using System.Xml.Serialization;
using cndp.Model.IModel;

namespace cndp.Model
{
    
    ///<summary>
    /// Diver - Diverklassen innehåller information om en simhoppare, t.ex. vilken klubb simhopparen tillhör. Diverklassen ärver från Personklassen.
    ///</summary>
    [Serializable]
    public class Diver : Person, IDiver
    {
        #region Variabels/Properties

        [XmlElement("CLUB")]
        public string Club { get; set; }

        #endregion

        #region Constructor

        public Diver()
        {
            Club = "";
        }

        public Diver(string name, string gender, string personalCodeNumber, string nationality, string club)
            : base(name, gender, personalCodeNumber, nationality)
        {
            Club = club;
        }

        #endregion

        #region Methods

        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            var objAsDiver = obj as Diver;
            if (objAsDiver == null) return false;
            return Equals(objAsDiver);
        }

        public bool Equals(Diver other)
        {
            if (other == null) return false;
            return (PersonalCodeNumber.Equals(other.PersonalCodeNumber));
        }



        #endregion
    }
}